home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / U.S. System⁄HyperCard / HyperCard—US 1.2.5 / HyperCard Ideas-US 1.2.5 / Idea Stacks / Stack Ideas / background_50429.txt < prev    next >
Encoding:
Text File  |  1988-11-07  |  10.9 KB  |  487 lines

  1. -- background: 50429 from stack: in
  2. -- bmap block id: 51937
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on newStack
  8.   extend
  9. end newStack
  10.  
  11. on extend
  12.   -- type "extend" into the message box and press return to make
  13.   -- a year's worth of new cards.
  14.   if the name of this stack contains "stack ideas"
  15.   then
  16.   answer "Please make a new stack before extending it." with "OK"
  17. else
  18.   answer "Make another year of new cards?" with "OK" or "Cancel"
  19.   if it is "Cancel" then exit extend
  20.   put 60*60*24 into OneDay        --seconds in a day
  21.   go to last card of this background
  22.   put getStartDate() into start      --what date to begin on
  23.   if start is "Cancel" then exit extend
  24.   put start into it        --a copy
  25.   convert it to long date
  26.   global calcMonth
  27.   put word 1 of item 2 of it into calcMonth
  28.   set name of this bkgnd to calcMonth
  29.   repeat with cnt = 1 to 53   --weeks in a year
  30.     put start into it        --a copy
  31.     convert it to long date
  32.     delete item 1 of it   -- get rid of "Monday,"
  33.     put it into field "Week"
  34.  
  35.     Repeat with index = 1 to 7
  36.       put word index of ("Monday Tuesday Wednesday Thursday" && "Friday Saturday Sunday") into myDay
  37.       put start into it
  38.       --convert each day so that date rolls over to "1"
  39.       --at end of month
  40.       convert it to long date
  41.       put (word 2 of item 2 of it) into field myDay
  42.       add OneDay to start
  43.     end repeat
  44.     doMenu New Card
  45.     upDateBkgnd start  --make a new background if new month
  46.   end repeat
  47.   doMenu "delete card"     --get rid of extra card at end
  48. end if
  49. end extend
  50.  
  51. on upDateBkgnd start
  52.   global calcMonth
  53.   put start into it        --a copy
  54.   convert it to long date
  55.   if word 1 of item 2 of it <> calcMonth then   --if new month
  56.     --create a new background.
  57.     put word 1 of item 2 of it into calcMonth
  58.     doMenu "Cut Card"    --new bkgnd is a copy with only name changed
  59.     go previous card
  60.     put the long name of this card into goodStack
  61.     set lockScreen to true
  62.     go to stack "home"
  63.     --must go to another stack to avoid changing the original bkgnd
  64.     doMenu "Paste Card"
  65.     set name of this background to word 1 of item 2 of it
  66.     doMenu "Cut Card"
  67.     go goodStack
  68.     set lockScreen to false
  69.     doMenu "Paste Card"
  70.     set name of this bkgnd to calcMonth
  71.   end if
  72. end upDateBkgnd
  73.  
  74. function getStartDate
  75. -- end of stack or today, whichever is newer
  76. get field "Week"
  77. if it is empty then put the date into it
  78. put startOfWeek(it) into it    --so we can compare
  79. put the date into thisWeek
  80. put startOfWeek(thisWeek) into thisWeek    --both at week starts in seconds
  81. if thisWeek < 2587766400 then
  82.   answer "Set the Control Panel to today's date" with "OK"
  83.   return "Cancel"
  84. end if
  85. if it >= thisWeek then return it   --calendar already beyond today
  86. convert it to short date
  87. convert thisWeek to short date
  88. answer "Start from which date?" with it or thisWeek or "Cancel"
  89. if it is "Cancel" then return it
  90. convert it to seconds
  91. return it
  92. end getStartDate
  93.  
  94. function startOfWeek aDate     -- the seconds for the start of this week
  95. put 60*60*24 into OneDay      --seconds in a day
  96. put aDate into it
  97. convert it to long date
  98. repeat while item 1 of it <> "Monday"
  99.   convert it to seconds
  100.   subtract OneDay from it
  101.   convert it to long date
  102. end repeat
  103. convert it to seconds
  104. return it
  105. end startOfWeek
  106.  
  107.  
  108.  
  109. on openBackground
  110.   push recent card
  111. end openBackground
  112.  
  113.  
  114. -- part 2 (field)
  115. -- low flags: 00
  116. -- high flags: 4000
  117. -- rect: left=33 top=57 right=131 bottom=176
  118. -- title width / last selected line: 0
  119. -- icon id / first selected line: 0 / 0
  120. -- text alignment: 0
  121. -- font id: 20
  122. -- text size: 12
  123. -- style flags: 0
  124. -- line height: 12
  125. -- part name: 
  126.  
  127.  
  128. -- part 3 (field)
  129. -- low flags: 00
  130. -- high flags: 4000
  131. -- rect: left=183 top=57 right=131 bottom=326
  132. -- title width / last selected line: 0
  133. -- icon id / first selected line: 0 / 0
  134. -- text alignment: 0
  135. -- font id: 20
  136. -- text size: 12
  137. -- style flags: 0
  138. -- line height: 12
  139. -- part name: 
  140.  
  141.  
  142. -- part 4 (field)
  143. -- low flags: 00
  144. -- high flags: 4000
  145. -- rect: left=333 top=57 right=131 bottom=476
  146. -- title width / last selected line: 0
  147. -- icon id / first selected line: 0 / 0
  148. -- text alignment: 0
  149. -- font id: 20
  150. -- text size: 12
  151. -- style flags: 0
  152. -- line height: 12
  153. -- part name: 
  154.  
  155.  
  156. -- part 5 (field)
  157. -- low flags: 00
  158. -- high flags: 4000
  159. -- rect: left=33 top=155 right=229 bottom=176
  160. -- title width / last selected line: 0
  161. -- icon id / first selected line: 0 / 0
  162. -- text alignment: 0
  163. -- font id: 20
  164. -- text size: 12
  165. -- style flags: 0
  166. -- line height: 12
  167. -- part name: 
  168.  
  169.  
  170. -- part 6 (field)
  171. -- low flags: 00
  172. -- high flags: 4000
  173. -- rect: left=183 top=155 right=229 bottom=326
  174. -- title width / last selected line: 0
  175. -- icon id / first selected line: 0 / 0
  176. -- text alignment: 0
  177. -- font id: 20
  178. -- text size: 12
  179. -- style flags: 0
  180. -- line height: 12
  181. -- part name: 
  182.  
  183.  
  184. -- part 7 (field)
  185. -- low flags: 00
  186. -- high flags: 4000
  187. -- rect: left=333 top=155 right=229 bottom=476
  188. -- title width / last selected line: 0
  189. -- icon id / first selected line: 0 / 0
  190. -- text alignment: 0
  191. -- font id: 20
  192. -- text size: 12
  193. -- style flags: 0
  194. -- line height: 12
  195. -- part name: 
  196.  
  197.  
  198. -- part 8 (field)
  199. -- low flags: 00
  200. -- high flags: 0000
  201. -- rect: left=98 top=33 right=56 bottom=132
  202. -- title width / last selected line: 0
  203. -- icon id / first selected line: 0 / 0
  204. -- text alignment: 0
  205. -- font id: 20
  206. -- text size: 18
  207. -- style flags: 0
  208. -- line height: 24
  209. -- part name: Monday
  210.  
  211.  
  212. -- part 9 (field)
  213. -- low flags: 00
  214. -- high flags: 0000
  215. -- rect: left=248 top=33 right=56 bottom=282
  216. -- title width / last selected line: 0
  217. -- icon id / first selected line: 0 / 0
  218. -- text alignment: 0
  219. -- font id: 20
  220. -- text size: 18
  221. -- style flags: 0
  222. -- line height: 24
  223. -- part name: Tuesday
  224.  
  225.  
  226. -- part 10 (field)
  227. -- low flags: 00
  228. -- high flags: 0000
  229. -- rect: left=421 top=33 right=56 bottom=455
  230. -- title width / last selected line: 0
  231. -- icon id / first selected line: 0 / 0
  232. -- text alignment: 0
  233. -- font id: 20
  234. -- text size: 18
  235. -- style flags: 0
  236. -- line height: 24
  237. -- part name: Wednesday
  238.  
  239.  
  240. -- part 11 (field)
  241. -- low flags: 00
  242. -- high flags: 0000
  243. -- rect: left=109 top=131 right=154 bottom=143
  244. -- title width / last selected line: 0
  245. -- icon id / first selected line: 0 / 0
  246. -- text alignment: 0
  247. -- font id: 20
  248. -- text size: 18
  249. -- style flags: 0
  250. -- line height: 24
  251. -- part name: Thursday
  252.  
  253.  
  254. -- part 12 (field)
  255. -- low flags: 00
  256. -- high flags: 0000
  257. -- rect: left=237 top=131 right=154 bottom=271
  258. -- title width / last selected line: 0
  259. -- icon id / first selected line: 0 / 0
  260. -- text alignment: 0
  261. -- font id: 20
  262. -- text size: 18
  263. -- style flags: 0
  264. -- line height: 24
  265. -- part name: Friday
  266.  
  267.  
  268. -- part 13 (field)
  269. -- low flags: 00
  270. -- high flags: 0000
  271. -- rect: left=354 top=131 right=154 bottom=388
  272. -- title width / last selected line: 0
  273. -- icon id / first selected line: 0 / 0
  274. -- text alignment: 0
  275. -- font id: 20
  276. -- text size: 18
  277. -- style flags: 0
  278. -- line height: 24
  279. -- part name: Saturday
  280.  
  281.  
  282. -- part 14 (field)
  283. -- low flags: 00
  284. -- high flags: 0000
  285. -- rect: left=417 top=131 right=154 bottom=451
  286. -- title width / last selected line: 0
  287. -- icon id / first selected line: 0 / 0
  288. -- text alignment: 0
  289. -- font id: 20
  290. -- text size: 18
  291. -- style flags: 0
  292. -- line height: 24
  293. -- part name: Sunday
  294.  
  295.  
  296. -- part 16 (field)
  297. -- low flags: 00
  298. -- high flags: 0000
  299. -- rect: left=317 top=243 right=268 bottom=495
  300. -- title width / last selected line: 0
  301. -- icon id / first selected line: 0 / 0
  302. -- text alignment: 1
  303. -- font id: 20
  304. -- text size: 18
  305. -- style flags: 0
  306. -- line height: 24
  307. -- part name: Week
  308.  
  309.  
  310. -- part 17 (button)
  311. -- low flags: 00
  312. -- high flags: 0000
  313. -- rect: left=446 top=274 right=304 bottom=484
  314. -- title width / last selected line: 0
  315. -- icon id / first selected line: 11045 / 11045
  316. -- text alignment: 1
  317. -- font id: 0
  318. -- text size: 12
  319. -- style flags: 0
  320. -- line height: 16
  321. -- part name: Home
  322. ----- HyperTalk script -----
  323. on mouseUp
  324.   visual effect iris close
  325.   go "Home"
  326. end mouseUp
  327.  
  328.  
  329.  
  330. -- part 18 (button)
  331. -- low flags: 00
  332. -- high flags: 0000
  333. -- rect: left=375 top=274 right=305 bottom=410
  334. -- title width / last selected line: 0
  335. -- icon id / first selected line: 30696 / 30696
  336. -- text alignment: 1
  337. -- font id: 0
  338. -- text size: 12
  339. -- style flags: 0
  340. -- line height: 16
  341. -- part name: Phone
  342. ----- HyperTalk script -----
  343. on mouseUp
  344.   get the selection
  345.   if it is empty then get the message
  346.   if it is empty then ask "Dial what number?"
  347.   if it is not empty then
  348.     push this card
  349.     visual effect zoom open
  350.     go to stack "Phone"
  351.     dial it
  352.     pop card
  353.   end if
  354. end mouseUp
  355.  
  356.  
  357.  
  358. -- part 19 (button)
  359. -- low flags: 00
  360. -- high flags: 0000
  361. -- rect: left=412 top=274 right=304 bottom=445
  362. -- title width / last selected line: 0
  363. -- icon id / first selected line: 0 / 0
  364. -- text alignment: 1
  365. -- font id: 0
  366. -- text size: 12
  367. -- style flags: 0
  368. -- line height: 16
  369. -- part name: Calendar
  370. ----- HyperTalk script -----
  371. on mouseUp
  372.   get the seconds
  373.   convert it to dateItems
  374.   put ((item 1 of it) - 1987) *2 into whichSix
  375.   if item 2 of it > 6 then add 1 to whichSix
  376.   visual effect zoom open
  377.   if whichSix < 1 then go card 1 of stack "Datebook"
  378.   else if whichSix > 5 then go card 5 of stack "Datebook"
  379.   else
  380.     go to card whichSix of stack "Datebook"
  381.     send "bracketWeek" && the seconds to this card
  382.   end if
  383. end mouseUp
  384.  
  385.  
  386.  
  387. -- part 20 (button)
  388. -- low flags: 00
  389. -- high flags: 0000
  390. -- rect: left=341 top=275 right=305 bottom=374
  391. -- title width / last selected line: 0
  392. -- icon id / first selected line: 0 / 0
  393. -- text alignment: 1
  394. -- font id: 0
  395. -- text size: 12
  396. -- style flags: 0
  397. -- line height: 16
  398. -- part name: Address
  399. ----- HyperTalk script -----
  400. on mouseUp
  401.   get the selection
  402.   visual effect zoom open
  403.   go to "Address"
  404.   if it is not empty then find it
  405. end mouseUp
  406.  
  407.  
  408.  
  409. -- part 22 (button)
  410. -- low flags: 00
  411. -- high flags: 0000
  412. -- rect: left=444 top=317 right=333 bottom=485
  413. -- title width / last selected line: 0
  414. -- icon id / first selected line: 6720 / 6720
  415. -- text alignment: 1
  416. -- font id: 0
  417. -- text size: 12
  418. -- style flags: 0
  419. -- line height: 16
  420. -- part name: Return
  421. ----- HyperTalk script -----
  422. on mouseUp
  423.   visual effect iris close
  424.   pop card
  425. end mouseUp
  426.  
  427.  
  428.  
  429. -- part 23 (button)
  430. -- low flags: 00
  431. -- high flags: 0000
  432. -- rect: left=224 top=315 right=338 bottom=252
  433. -- title width / last selected line: 0
  434. -- icon id / first selected line: 15420 / 15420
  435. -- text alignment: 1
  436. -- font id: 0
  437. -- text size: 12
  438. -- style flags: 0
  439. -- line height: 16
  440. -- part name: 
  441. ----- HyperTalk script -----
  442. on mouseUp
  443.   visual effect wipe right
  444.   go to prev card
  445. end mouseUp
  446.  
  447.  
  448.  
  449.  
  450. -- part 24 (button)
  451. -- low flags: 00
  452. -- high flags: 0000
  453. -- rect: left=267 top=315 right=338 bottom=294
  454. -- title width / last selected line: 0
  455. -- icon id / first selected line: 16560 / 16560
  456. -- text alignment: 1
  457. -- font id: 0
  458. -- text size: 12
  459. -- style flags: 0
  460. -- line height: 16
  461. -- part name: 
  462. ----- HyperTalk script -----
  463. on mouseUp
  464.   visual effect wipe left
  465.   go to next card
  466. end mouseUp
  467.  
  468.  
  469.  
  470. -- part 25 (button)
  471. -- low flags: 00
  472. -- high flags: 8004
  473. -- rect: left=387 top=318 right=333 bottom=433
  474. -- title width / last selected line: 0
  475. -- icon id / first selected line: 0 / 0
  476. -- text alignment: 1
  477. -- font id: 3
  478. -- text size: 9
  479. -- style flags: 0
  480. -- line height: 12
  481. -- part name: Extend
  482. ----- HyperTalk script -----
  483. on mouseUp
  484.   extend
  485. end mouseUp
  486.  
  487.